package cn.smile.commons.enums.basic;

import lombok.Getter;
import org.springframework.util.ObjectUtils;

import java.util.Objects;

/**
 * 系统预置字典项
 */
@Getter
public enum PredefinedDicEnum {
    /**
     * 店员职位
     */
    STAFF_POSITION("1777877567770038274", "店员职位"),
    /**
     * 未知
     */
    NULL("-1", "未知");
    private final String sn;
    private final String msg;

    PredefinedDicEnum(String sn, String msg) {
        this.sn = sn;
        this.msg = msg;
    }

    public static PredefinedDicEnum get(String code) {
        if (!ObjectUtils.isEmpty(code)) {
            for (PredefinedDicEnum status : values()) {
                if (Objects.equals(status.getSn(), code)) {
                    return status;
                }
            }
        }
        return NULL;
    }
}
